public class test07 {
    public int removeDuplicates(int[] nums) {
        //双指针法
        int slow = 0;
        for(int fast = 1;fast<nums.length;fast++){
            if(nums[fast]!=nums[slow]){
                slow++;
                nums[slow] = nums[fast];
            }
        }
        return slow+1;
    }
}
